package Year2011;

import java.util.Scanner;
/**
 * 递归
 */
public class 金额查错_4 {

    public static void main(String[] args) {
        // Scanner scanner = new Scanner(System.in);
        // int wrongAmount, itemCount, missingAmount = 0;
        // wrongAmount = scanner.nextInt();
        // itemCount = scanner.nextInt();
        // int[] items = new int[itemCount];
        // int[] check = new int[itemCount];
        // for (int i = 0; i < itemCount; i++) {
        //     items[i] = scanner.nextInt();
        //     check[i] = 0; // 标记数组，0：：表示元素未访问，1：访问
        // }
        // for (int i = 0; i < items.length; i++) {
        //     missingAmount += items[i];
        // }
        // missingAmount = missingAmount - wrongAmount;
        // System.out.println("missingAmount:"+missingAmount);
        // quickSortArrayOneDimensional(items);
        // showArrayOneDimensional(items);

        System.out.printf("%c",97);
        System.out.printf("%c",65);
        System.out.println();
        int missingAmountl = 7;
        int[] itemsl = {1,2,3,3,4}; //{3,2,4,3,1};
        int[] checkl = {0,0,0,0,0};
        // recurison(0,itemsl,checkl,missingAmountl,0);

        // scanner.close();
    }

    public static void recurison(int index,int[] items,int[] check, int missingAmount,int tempAmount) {
        int tempacount = tempAmount;
        if(tempAmount == missingAmount){
            for (int i = 0; i < check.length; i++) {
                if(check[i] == 1)
                    System.out.print(items[i]+"\t");
            }
            tempacount =0;
            System.out.println();
            return;
        }
        for (int i = index; i < items.length; i++) {
            if(check[i] == 0 && tempAmount+items[i] < missingAmount){
                System.out.println("items["+i+"]:"+items[i]+"\t");
                tempAmount += items[i];
                check[i] = 1;
                recurison(i+1,items,check,missingAmount,tempacount);
                check[i] = 0;
            }
            System.out.println('*');
        }
    }
}
